package com.alpha.processor.util;

import com.alpha.binder.anno.app.BinderApp;
import com.alpha.binder.anno.provider.Provider;

import javax.lang.model.type.MirroredTypeException;
import javax.lang.model.type.TypeMirror;

public class ParseTypeUtil {

    public static TypeMirror fromAppR(BinderApp anno) {
        try {
            anno.R();
        } catch (MirroredTypeException exception) {
            return exception.getTypeMirror();
        }
        return null;
    }

    public static TypeMirror fromProviderView(Provider provider) {
        try {
            provider.view();
        } catch (MirroredTypeException exception) {
            return exception.getTypeMirror();
        }
        return null;
    }

    public static TypeMirror fromProviderProcessor(Provider provider) {
        try {
            provider.processor();
        } catch (MirroredTypeException exception) {
            return exception.getTypeMirror();
        }
        return null;
    }


}
